package com.chainyoung.component_tmtrade.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

public class FiatTradeListItem implements Parcelable {


    /**
     * id : 131202
     * is_online : false
     * uid : PjKnjd9kwSdN73oOeSEahrZc8Aen/Arl61O6Ag
     * avatar : head/11111
     * username : bbb
     * trade_num : 0
     * trade_type : [{"id":33,"name":"aaa","bankcard":"123456","type":2,"receivables_code":"http://chengyang.webserver.com/uploads/receivables/20180404/1680aa1190e63d72344187be1b961bf2.jpg"}]
     * num : 197
     * coin : LTC
     * mum : 160000
     * mum_cny : 773808
     * trade_min :
     * trade_max :
     * price : 800
     * price_cny : 3869.04
     * rate : 1
     */

    private String id;
    private boolean is_online;
    private String uid;
    private String avatar;//头像
    private String username;//用户名
    private String trade_num;//	最近30天交易次数
    private String num;//交易数量
    private String coin;//币种
    private String mum;//澳元总和
    private String mum_cny;//人民币总和
    private String trade_min;//限制最小交易额
    private String trade_max;//限制最大交易额
    private String price;//澳元单价
    private String price_cny;//人民币单价
    private String rate;//澳元兑换人民币的汇率
    private List<TradeTypeBean> trade_type;


    protected FiatTradeListItem(Parcel in) {
        id = in.readString();
        is_online = in.readByte() != 0;
        uid = in.readString();
        avatar = in.readString();
        username = in.readString();
        trade_num = in.readString();
        num = in.readString();
        coin = in.readString();
        mum = in.readString();
        mum_cny = in.readString();
        trade_min = in.readString();
        trade_max = in.readString();
        price = in.readString();
        price_cny = in.readString();
        rate = in.readString();
        trade_type = in.createTypedArrayList(TradeTypeBean.CREATOR);
    }

    public static final Creator<FiatTradeListItem> CREATOR = new Creator<FiatTradeListItem>() {
        @Override
        public FiatTradeListItem createFromParcel(Parcel in) {
            return new FiatTradeListItem(in);
        }

        @Override
        public FiatTradeListItem[] newArray(int size) {
            return new FiatTradeListItem[size];
        }
    };

    public boolean isIs_online() {
        return is_online;
    }

    public void setIs_online(boolean is_online) {
        this.is_online = is_online;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getTrade_num() {
        return trade_num;
    }

    public void setTrade_num(String trade_num) {
        this.trade_num = trade_num;
    }


    public String getCoin() {
        return coin;
    }

    public void setCoin(String coin) {
        this.coin = coin;
    }


    public String getTrade_min() {
        return trade_min;
    }

    public void setTrade_min(String trade_min) {
        this.trade_min = trade_min;
    }

    public String getTrade_max() {
        return trade_max;
    }

    public void setTrade_max(String trade_max) {
        this.trade_max = trade_max;
    }


    public List<TradeTypeBean> getTrade_type() {
        return trade_type;
    }

    public void setTrade_type(List<TradeTypeBean> trade_type) {
        this.trade_type = trade_type;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public String getMum() {
        return mum;
    }

    public void setMum(String mum) {
        this.mum = mum;
    }

    public String getMum_cny() {
        return mum_cny;
    }

    public void setMum_cny(String mum_cny) {
        this.mum_cny = mum_cny;
    }

    public String getPrice_cny() {
        return price_cny;
    }

    public void setPrice_cny(String price_cny) {
        this.price_cny = price_cny;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getRate() {
        return rate;
    }

    public void setRate(String rate) {
        this.rate = rate;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(id);
        dest.writeByte((byte) (is_online ? 1 : 0));
        dest.writeString(uid);
        dest.writeString(avatar);
        dest.writeString(username);
        dest.writeString(trade_num);
        dest.writeString(num);
        dest.writeString(coin);
        dest.writeString(mum);
        dest.writeString(mum_cny);
        dest.writeString(trade_min);
        dest.writeString(trade_max);
        dest.writeString(price);
        dest.writeString(price_cny);
        dest.writeString(rate);
        dest.writeTypedList(trade_type);
    }

    public static class TradeTypeBean implements Parcelable {
        /**
         * id : 33
         * name : aaa
         * bankcard : 123456
         * type : 2
         * receivables_code : http://chengyang.webserver.com/uploads/receivables/20180404/1680aa1190e63d72344187be1b961bf2.jpg
         */

        private String id;
        private String name;//账户名
        private String bankcard;//账号
        private int type;
        private String receivables_code;


        protected TradeTypeBean(Parcel in) {
            id = in.readString();
            name = in.readString();
            bankcard = in.readString();
            type = in.readInt();
            receivables_code = in.readString();
        }

        public static final Creator<TradeTypeBean> CREATOR = new Creator<TradeTypeBean>() {
            @Override
            public TradeTypeBean createFromParcel(Parcel in) {
                return new TradeTypeBean(in);
            }

            @Override
            public TradeTypeBean[] newArray(int size) {
                return new TradeTypeBean[size];
            }
        };

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getBankcard() {
            return bankcard;
        }

        public void setBankcard(String bankcard) {
            this.bankcard = bankcard;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }

        public String getReceivables_code() {
            return receivables_code;
        }

        public void setReceivables_code(String receivables_code) {
            this.receivables_code = receivables_code;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(id);
            dest.writeString(name);
            dest.writeString(bankcard);
            dest.writeInt(type);
            dest.writeString(receivables_code);
        }
    }


}
